from langchain_ollama import ChatOllama
llm = ChatOllama(
    base_url="http://169.254.57.191:25000",
    model="qwen2:7b",
    #model="llama3:latest",
    #temperature=0,
    # other params...
)


#from langchain_core.messages import AIMessage
'''
messages = [
    (
        "system",
        "You are a helpful assistant that translates English to French. Translate the user sentence.",
    ),
    ("human", "I love programming."),
]
ai_msg = llm.invoke(messages)
print(ai_msg.content)
'''

with open('news1.txt') as f:
    news_content = f.read()


from langchain_core.prompts import PromptTemplate

with open('summarize.txt') as f:
    summary_cmd = f.read()

prompt = PromptTemplate.from_template(summary_cmd)

chain = prompt | llm
result = chain.invoke({'text': news_content})
print(result.content)
